goog.provide('dkpoints.models.Raider');
goog.provide('dkpoints.models.Raider.CSSClass');
goog.provide('dkpoints.models.Raider.Class');


/**
 * @fileoverview Class that describes a Raider and contains related enums and
 * utility methods.
 */



/**
 * A Raider object.
 * @param {string} name The Raider's name.
 * @param {dkpoints.models.Raider.Class} raiderClass The raider's class.
 * @constructor
 */
dkpoints.models.Raider = function(name, raiderClass) {
  /**
   * @type {string}
   * @private
   */
  this.name_ = name;

  /**
   * @type {dkpoints.models.Raider.Class}
   * @private
   */
  this.class_ = raiderClass;
};


/**
 * @return {string} The raider's name.
 */
dkpoints.models.Raider.prototype.getName = function() {
  return this.name_;
};


/**
 * @return {dkpoints.models.Raider.Class} The raider's class.
 */
dkpoints.models.Raider.prototype.getClass = function() {
  return this.class_;
};


/**
 * @param {dkpoints.models.Raider} other The other raider.
 * @return {boolean} Whether the given raider is the same as this one.
 */
dkpoints.models.Raider.prototype.isSameRaider = function(other) {
  return this.name_ === other.name_ && this.class_ === other.class_;
};


/**
 * Returns a clone of this raider object.
 * @return {dkpoints.models.Raider} The cloned Raider object.
 */
dkpoints.models.Raider.prototype.clone = function() {
  return new dkpoints.models.Raider(this.name_, this.class_);
};


/**
 * Check whether the given string is a valid player name.  Player names cannot
 * include spaces or numbers, but can include all kinds of funky weird
 * characters (unfortunately).
 *
 * @param {string} name The name to check.
 * @return {boolean} Returns whether the given name is valid.
 */
dkpoints.models.Raider.isValidName = function(name) {
  return ((typeof name == 'string') &&
          (name !== '') &&
          (! /[\s0-9]/.test(name)));
};


/**
 * Printable names for each class.
 * @enum {string}
 */
dkpoints.models.Raider.Class = {
  DEATHKNIGHT: 'Death Knight',
  PALADIN: 'Paladin',
  WARRIOR: 'Warrior',
  HUNTER: 'Hunter',
  SHAMAN: 'Shaman',
  DRUID: 'Druid',
  ROGUE: 'Rogue',
  MAGE: 'Mage',
  PRIEST: 'Priest',
  WARLOCK: 'Warlock',
  NONE: 'noclass'
};


/**
 * A mapping of the Title Case Raider.Class value to the CSS class used for
 * each player class.
 * Typical use case would be:
 *    getCssName(dkpoints.models.Raider.CSSClass[raider.getClass()];
 *
 * @enum {string}
 */
dkpoints.models.Raider.CSSClass = {
  'Death Knight': goog.getCssName('deathknight'),
  'Paladin': goog.getCssName('paladin'),
  'Warrior': goog.getCssName('warrior'),
  'Hunter': goog.getCssName('hunter'),
  'Shaman': goog.getCssName('shaman'),
  'Druid': goog.getCssName('druid'),
  'Rogue': goog.getCssName('rogue'),
  'Mage': goog.getCssName('mage'),
  'Priest': goog.getCssName('priest'),
  'Warlock': goog.getCssName('warlock'),
  'noclass': goog.getCssName('noclass')
};
